import http from "@/api";
import { Goods, ResPage } from "../interface";

const BASE_PATH = "/goods";

/**
 * @description 商品列表
 */
export const listPageApi = (params: Goods.Query) => {
  return http.get<ResPage<Goods.ListData>>(BASE_PATH, params);
};
/**
 * @description 新增商品
 */
export const insertApi = (params: Goods.GoodsEditFrom) => {
  return http.post(BASE_PATH, params);
};
/**
 * @description 编辑商品
 */
export const updateApi = (params: Goods.GoodsEditFrom) => {
  return http.put(BASE_PATH, params);
};
/**
 * @description 删除商品
 */
export const delApi = (id: string) => {
  return http.delete(`${BASE_PATH}/${id}`);
};
/**
 * @description 获取商品
 */
export const getApi = (id: string) => {
  return http.get<Goods.GoodsEditFrom>(`${BASE_PATH}/${id}`);
};
